package com.cn.bulu.constant;

public enum PayMethod {
	
	ALIPAY("支付宝支付",0),
	BALABCEPAY("余额支付",1),
	WECHATPAY("微信支付",2),
	OTHERPAY("其他支付",3);
	
	private String method;
	private int index;
	
	private PayMethod(){}
	
	private PayMethod(String method,int index){
		this.index = index;
		this.method = method;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}
	
	/**
	 * 根据支付方式字符串然后获取对应的下标
	 * @param method
	 * @return
	 */
	public static int getMethodIndex(String method){
		for (PayMethod mccEnum : PayMethod.values()) {  
            if (mccEnum.getMethod().equals(method)) {  
                return mccEnum.getIndex();
            }  
        } 
		
		return OTHERPAY.index;
	}
	
}
